<template>
    <div v-if="data.length>0">
      <h1>{{index|fmtOrder2CN}}、{{title}} 共{{data.length}}题</h1>
      <ul>
        <li class="item"
            v-for="(item,i) in data"
            :key="item.id">
          <button class="btn-add"
                  @click="removeFromCart(item.id)">移除试题车</button>
          <h4>{{i+1}}.[{{item.type | fmtSubjectType}}]{{item.title}}</h4>
          <div style="color:#888;font-size:14px;padding:10px 0">{{item.author}}{{item.createTime}}</div>
          <fieldset style="padding:10px 0"
                    v-if="checkIsXZT(item.type)">
            <legend>选项</legend>
            <div v-for="(option,i) in item.options"
                 :key="option.id">
              {{i | fmtOrder2ABC}}{{option.val}}
            </div>
          </fieldset>

        </li>
        </ul>
    </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
let { mapMutations} = createNamespacedHelpers("subject");
export default{
    props:["title","data","index"],
    methods:{
        ...mapMutations(["removeFromCart"])
    }

}; 

</script>
<style>

</style>